package com.bkhc.product.repository;

import com.bkhc.common.util.response.PageUtil;
import com.bkhc.common.util.response.ResultJson;
import com.bkhc.common.vo.OrderItemVo;
import com.bkhc.common.vo.OrderVo;
import com.bkhc.product.entity.Partner;
import com.bkhc.product.vo.PartnerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Component
public class PartnerAppRepository {
    @Autowired
    private RestTemplate restTemplate;

    public ResultJson addPartner(PartnerVo partner){
        String serviceName = "PARTNER-APP";
        String url = "http://" + serviceName + "/partner/manage/addPartner";
        ResultJson result = restTemplate.postForObject(url, partner, ResultJson.class);
        return result;
    }

    public void deletePartnerCode(String partnerCode) {
        String serviceName = "PARTNER-APP";
        String url = "http://" + serviceName + "/partner/manage/deletePartner/"+partnerCode;
        ResultJson result = restTemplate.postForObject(url, null, ResultJson.class);
    }
}
